$(function() {

	$("#btnSumbit").click(function() {
		var params = $("#form").serializeObject();
		var winIndex = parent.layer.getFrameIndex(window.name);
		var loadid = layer.load("加载中");
		$.ajax({
			type : 'POST',
			async : false,
			data : JSON.stringify(params),
			url : ctx + '/sys/role/save',
			datatype : "json",
			timeout : 20000,
			success : function(data) {
				if (data.code == 0) {
					layer.close(loadid);
					layer.open({
						content : '保存成功！',
						yes : function(index, layero) {
							parent.layer.close(winIndex);
						}
					});

				} else {
					parent.layer.alert(data.msg);
					layer.close(loadid);
				}
			},
			error : function(data) {
				alert(data.msg);
				layer.close(loadid);
			}
		});
	})
	
	if(!isNull(role)){
//		$setValues($("#form"),role);
	}

});
